<?php
/**
 * 页面渲染
 * Author: liushanshan
 * Date: 2019/2/21 0021
 */
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;

class UserController extends Controller {
    public function index($css='css/index.css',$content='main'){
        //视图路径可用点隔开，也可用斜线，推荐用点
        return view('index',[
            'css'       =>  $css,
            'content'   =>  $content
        ]);
    }
    public function introduce(){
        return view('index',[
            'css'       =>  'css/score.css',
            'content'   =>  'introduce'
        ]);
    }
    public function dagang(){
        return view('index',[
            'css'       =>  'css/dagang.css',
            'content'   =>  'dagang'
        ]);
    }
    public function kejian(){
        return view('index',[
            'css'       =>  'css/kejian.css',
            'content'   =>  'kejian'
        ]);
    }
    public function shiyan(){
        return view('index',[
            'css'       =>  'css/shiyan.css',
            'content'   =>  'shiyan'
        ]);
    }
    public function lianxi(){
        return view('index',[
            'css'       =>  'css/lianxi.css',
            'content'   =>  'lianxi'
        ]);
    }

//    public function message(){
//        return view('index',[
//            'css'       =>  'css/kejian.css',
//            'content'   =>  'message'
//        ]);
//    }

    public function message(Request $request){
        $data = [
            'errcode'=>0,
            'errmsg'=>'success',
            'data'=>'sum'
        ];
        //响应json
//        return response()->json($data);

        //重定向,跳转页面
//        return redirect('index');
        //重定向,跳转页面，带信息
        return redirect('message1')->with('message','数据');
    }

    public function message1(Request $request){
        return Session::get('message','not');
    }

}